<!--{template header}-->
<link href="/template/default/center.css" rel="stylesheet" type="text/css"/>
<link href="/template/default/publish.css" rel="stylesheet" type="text/css"/>
<script language="javascript" type="text/javascript" src="source/My97DatePicker/WdatePicker.js"></script>
<div class="center">
        	<div class="center_left_menu">
            	<ul>
                	<li class="top"><a href="/cp.php?ac=profile">个人资料</a></li>
                    <li><a href="/cp.php?ac=avatar">修改头像</a></li>
					<li><a href="/cp.php?ac=password">修改密码</a></li>
					<li><a href="/cp.php?ac=publish" class="on">发布活动</a></li>
					<li><a href="">已参加活动</a></li>
                    <li><a href="">个人推广数</a></li>
                    <li><a href="">我的分享</a></li>
                    <li><a href="">我的代言</a></li>
                    <li><a href="">我的小组</a></li>
                    <li><a href="/contribute.php">我的稿件</a></li>
                    <li><a href="/cp.php?ac=follow">关注&粉丝</a></li>
                    <li><a href="/space.php?do=udisk">网盘</a></li>
                    <li><a href="/admincp.php">高级管理</a></li>
                </ul>
            </div>
          <div class="center_right_content" style="height:auto">
            	<div class="top_menu">
                	<ul>
                    	<li>
                        	<a href="/cp.php?ac=activity" <!--{eval echo $op != 'find' ? 'class="on"' : ''}-->>发布活动</a>
                        </li>
						<li>
                        	<a href="/cp.php?ac=activity&op=find" <!--{eval echo $op == 'find' ? 'class="on"' : ''}-->>发现活动</a>
                        </li>
                    </ul>
                </div>
                <div class="form">
					<style type="text/css">
						.userData {behavior:url(#default#userdata);}
					</style>
					<script language="javascript" src="image/editor/editor_function.js"></script>
					<script language="javascript" src="source/script_blog.js"></script>
					<!--{if $op != 'find'}-->
                    <form action="" name="myFrom" id="myFrom" method="post" onsubmit="return check();" enctype="multipart/form-data">
                        <ul>
                        	<li>
                                <label>名称:</label>
                                <input type="text" name="title" id="title" class="input_publish" value="$setarr['a_topic']"/>
                                <span class="msg"><!--{eval echo $errors['title'] ? $errors['title'] : '活动的名称或主题';}--></span>
                            </li>
                            <li>
                                <label>地址:</label>
                                <input type="text" name="address" id="address" class="input_publish"  value="$setarr['a_address']"/>
                                <span class="msg"><!--{eval echo $errors['address'] ? $errors['address'] : '活动进行的地址';}--></span>
                            </li>
                            <li>
                                <label>城市:</label>
                                <div id="residecitybox" class="residecitybox">
								<!--{eval $address = explode(' ',$setarr['a_city']);}-->
								</div>
								<script type="text/javascript" src="source/script_city.js"></script>
								<script type="text/javascript">
								<!--
								showprovince('resideprovince', 'residecity', '<!--{eval echo  $resideprovince ? $resideprovince : $address[0]}-->', 'residecitybox');
								showcity('residecity', '<!--{eval echo  $residecity ? $residecity : $address[1]}-->', 'resideprovince', 'residecitybox');
								//-->
								</script>
                                <span class="msg"><!--{eval echo $errors['city'] ? $errors['city'] : '活动进行的所在城市';}--></span>
                            </li>
                            <li>
                                <label>结束时间:</label>
                                <input type="text" name="enddate" id="enddate" class="input_publish WDate" value="<!--{eval echo $setarr['a_endtime'] ? date('Y-m-d H:m:s',$setarr['a_endtime']) : '';}-->" readonly="readonly" onFocus="WdatePicker({isShowClear:false,readOnly:true,doubleCalendar:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
                                <span class="msg"><!--{eval echo $errors['enddate'] ? $errors['enddate'] : '活动结束的时间';}--></span>
                            </li>
                            <li>
                                <label>活动规模:</label>
                                <select style="width:120px" name="scale" id="scale">
                                	$activityScale
                                </select>
                                <span class="msg"><!--{eval echo $errors['scale'] ? $errors['scale'] : '参加活动的最佳人数';}--></span>
                            </li>
                            <li>
                                <label>活动类别:</label>
                                <select style="width:120px" name="classis" id="classis">
                                	$activityClassis
                                </select>
                                <span class="msg"><!--{eval echo $errors['classis'] ? $errors['classis'] : '活动的类别';}--></span>
                            </li>
                            <li>
                                <label>轮盘模式:</label>
                                <input type="radio" name="lottery" value="1" <!--{eval echo $_POST['lottery'] ? 'checked="checked"' : '';}-->/>&nbsp;开启
                                <input type="radio" name="lottery" value="0" <!--{eval echo !$_POST['lottery'] ? 'checked="checked"' : '';}-->/>&nbsp;关闭
                                <span class="msg"></span>
                            </li>
                            <li style="<!--{eval echo $_POST['lottery'] ? 'display:block;' : 'display:none;';}-->height: auto; border: 1px solid rgb(255, 210, 210); width: 300px; margin-left: 85px;" id="lotteryArea">
                            	<div style="margin-left:10px">
                                	<label>每次轮盘消耗:</label>
                                    <select name="integral" id="integral" style="width:85px;">
										<!--{eval
											for($i=1;$i<21;$i++){
												echo '<option value="'.$i.'" '.($i == $_POST['integral'] ? 'selected="selected"' : '').'>'.$i.'积分</option>';
											}
										}-->
                                    </select>
                                </div>
                               	<div style="margin-left:10px">
                                    <label>中奖区间:</label>
                                    <select id="sarea" name="sarea">
                                    	<!--{eval 
											for($i=1;$i<101;$i++){
												echo '<option value="'.$i.'" '.($i == $_POST['sarea'] ? 'selected="selected"' : '').'>'.$i.'</option>';
											}
										}-->
                                    </select>
                                    ~
                                    <select id="earea" name="earea">
                                    	<!--{eval 
											for($i=1;$i<101;$i++){
												echo '<option value="'.$i.'" '.($i == $_POST['earea'] ? 'selected="selected"' : '').'>'.$i.'</option>';
											}
										}-->
                                    </select>
                               </div>
                               <div style="margin-left:10px">
                                    <label>中奖礼品数:</label>
                                    <input type="text" class="input" name="prizenum" id="prizenum" value="$_POST['prizenum']"/>
                                </div>
                            </li>
                            <li>
                                <label>活动开展方式:</label>
                                <input type="radio" value="1" name="manner" id="manner" <!--{eval echo $_POST['manner'] || $_POST['manner'] === '' || !isset($_POST['manner']) ? 'checked="checked"' : '';}-->/>&nbsp;线上活动
                                <input type="radio" value="0" name="manner" id="manner" <!--{eval echo $_POST['manner'] === '0' ? 'checked="checked"' : '';}-->/>&nbsp;线下活动
                                <span class="msg"></span>
                            </li>
                            <li>
                                <label>是否显示期望:</label>
                                <input type="radio" value="1" name="expect" id="expect" <!--{eval echo $_POST['expect'] || $_POST['expect'] === '' || !isset($_POST['expect']) ? 'checked="checked"' : ''}-->/>&nbsp;显示
                                <input type="radio" value="0" name="expect" id="expect" <!--{eval echo $_POST['expect'] === '0' ? 'checked="checked"' : ''}-->/>&nbsp;不显示
                                <span class="msg"></span>
                            </li>
                            <li>
                                <label>推广入选人数:</label>
                                <input type="text" name="peoples" id="peoples" class="input_publish" value="$_POST['peoples']"/>
                                <span class="msg"><!--{eval echo $errors['peoples'] ? $errors['peoples'] : '推广入选人数';}--></span>
                            </li>
                            <li>
                                <label>联系人:</label>
                                <input type="text" name="contactname" id="contactname" class="input_publish" value="$_POST['contactname']" />
                                <span class="msg"><!--{eval echo $errors['contactname'] ? $errors['contactname'] : '活动联系人';}--></span>
                            </li>
                            <li>
                                <label>联系电话:</label>
                                <input type="text" name="contacttel" id="contacttel" class="input_publish" value="$_POST['contacttel']" />
                                <span class="msg"><!--{eval echo $errors['contacttel'] ? $errors['contacttel'] : '活动联系人的电话';}--></span>
                            </li>
                            <li>
                                <label>联系QQ:</label>
                                <input type="text" name="contactqq" id="contactqq" class="input_publish" value="$_POST['contactqq']" />
                                <span class="msg"><!--{eval echo $errors['contactqq'] ? $errors['contactqq'] : '活动联系人的QQ';}--></span>
                            </li>
                            <li>
                                <label>活动封面:</label>
                                <input type="file" name="pic" id="pic" size="26" value="$_POST['pic']"/>
                                <span class="msg">活动的宣传图片或海报</span>
                            </li>
							<li style="height:auto">
								<label style="vertical-align: top;">活动说明:</label>
								<div style="display: inline;">
								<a id="doodleBox" href="magic.php?mid=doodle&showid=blog_doodle&target=uchome-ttHtmlEditor&from=editor" style="display:none"></a>
								<textarea class="userData" name="content" id="uchome-ttHtmlEditor" style="height:100%;width:100%;display:none;border:0px">$_POST[content]</textarea>
								<iframe src="editor.php?charset=$_SC[charset]&allowhtml=$allowhtml&doodle=<!--{if isset($_SGLOBAL[magic][doodle])}-->1<!--{/if}-->" name="uchome-ifrHtmlEditor" id="uchome-ifrHtmlEditor" scrolling="no" border="0" frameborder="0" style="width:600px;border: 1px solid #C5C5C5;" height="400"></iframe>
								</div>
								<span class="msg" style=" display: block;margin-right: 130px;margin-top: -25px;text-align: right;"><!--{eval echo $errors['content'] ? $errors['content'] : '活动说明最少50字';}--></span>
							</li>
							<li style="height:auto">
								<label style="vertical-align: top;">奖品说明:</label>
								<div style="display: inline;">
								<a id="doodleBox" href="magic.php?mid=doodle&showid=blog_doodle&target=uchome-ttHtmlEditor&from=editor" style="display:none"></a>
								<textarea class="userData" name="lottery" id="uchome-ttHtmlEditor" style="height:100%;width:100%;display:none;border:0px">$_POST[content]</textarea>
								<iframe src="editor.php?charset=$_SC[charset]&allowhtml=$allowhtml&doodle=<!--{if isset($_SGLOBAL[magic][doodle])}-->1<!--{/if}-->" name="uchome-ifrHtmlEditor" id="uchome-ifrHtmlEditor" scrolling="no" border="0" frameborder="0" style="width:600px;border: 1px solid #C5C5C5;" height="400"></iframe>
								</div>
								<span class="msg" style=" display: block;margin-right: 130px;margin-top: -25px;text-align: right;"><!--{eval echo $errors['content'] ? $errors['content'] : '活动说明最少50字';}--></span>
							</li>
							 <li>
								<input type="hidden" name="activitysubmit" value="yes" />
								<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
                                <input type="submit" class="sub" value="确认发布" style="margin-left:85px;margin-bottom:30px;"/>
                            </li>
                            <li></li>
                        </ul>
                    </form>
					<!--{else}-->
					<div class="notic" style="margin-left:0px;">
						<p>
							在其他地方发现不错的活动？没问题，来这里分享给你的好友吧！<br /> 
							请仔细对比填写以下信息。
						</p>
					</div>
					<form action="" name="myFrom" id="myFrom" method="post" onsubmit="return check();" enctype="multipart/form-data">
                        <ul>
                        	<li>
                                <label>活动名称:</label>
                                <input type="text" name="title" id="title" class="input_publish" value="$setarr['o_title']"/>
                                <span class="msg"><!--{eval echo $errors['title'] ? $errors['title'] : '活动的名称或主题';}--></span>
                            </li>
                            <li>
                                <label>活动链接:</label>
                                <input type="text" name="address" id="address" class="input_publish"  value="$setarr['o_url']"/>
                                <span class="msg"><!--{eval echo $errors['address'] ? $errors['address'] : '活动进行的链接地址';}--></span>
                            </li>
							<li>
                                <label>活动城市:</label>
                                <div id="residecitybox" class="residecitybox">
								<!--{eval $address = explode(' ',$setarr['o_city']);}-->
								</div>
								<script type="text/javascript" src="source/script_city.js"></script>
								<script type="text/javascript">
								<!--
								showprovince('resideprovince', 'residecity', '<!--{eval echo  $resideprovince ? $resideprovince : $address[0]}-->', 'residecitybox');
								showcity('residecity', '<!--{eval echo  $residecity ? $residecity : $address[1]}-->', 'resideprovince', 'residecitybox');
								//-->
								</script>
                                <span class="msg"><!--{eval echo $errors['city'] ? $errors['city'] : '活动进行的所在城市';}--></span>
                            </li>
							<li>
                                <label>结束时间:</label>
                                <input type="text" name="enddate" id="enddate" class="input_publish WDate" value="<!--{eval echo $setarr['o_endtime'] ? date('Y-m-d H:m:s',$setarr['a_endtime']) : '';}-->" readonly="readonly" onFocus="WdatePicker({isShowClear:false,readOnly:true,doubleCalendar:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})"/>
                                <span class="msg"><!--{eval echo $errors['enddate'] ? $errors['enddate'] : '活动结束的时间';}--></span>
                            </li>
							<li>
                                <label>活动封面:</label>
                                <input type="file" name="pic" id="pic" size="26" value="$_POST['pic']"/>
                                <span class="msg">活动的宣传图片或海报</span>
                            </li>
							<li style="height:auto">
								<label style="vertical-align: top;">活动说明:</label>
								<div style="display: inline;">
								<a id="doodleBox" href="magic.php?mid=doodle&showid=blog_doodle&target=uchome-ttHtmlEditor&from=editor" style="display:none"></a>
								<textarea class="userData" name="content" id="uchome-ttHtmlEditor" style="height:100%;width:100%;display:none;border:0px">$_POST[content]</textarea>
								<iframe src="editor.php?charset=$_SC[charset]&allowhtml=$allowhtml&doodle=<!--{if isset($_SGLOBAL[magic][doodle])}-->1<!--{/if}-->" name="uchome-ifrHtmlEditor" id="uchome-ifrHtmlEditor" scrolling="no" border="0" frameborder="0" style="width:600px;border: 1px solid #C5C5C5;" height="400"></iframe>
								</div>
								<span class="msg" style=" display: block;margin-right: 130px;margin-top: -25px;text-align: right;"><!--{eval echo $errors['content'] ? $errors['content'] : '活动说明最少50字';}--></span>
							</li>
							<li style="margin-bottom:30px;">
								<input type="hidden" name="findsubmit" value="yes" />
								<input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" />
                                <input type="submit" class="sub" value="确认发布" style="margin-left:85px;"/>
                            </li>
						</ul>
					</form>
					<!--{/if}-->
                </div>
            </div>
        </div>
		<script type="text/javascript">
			<!--{if $op == 'find'}-->
			function check(){
				edit_save();
				//验证标题字数
				if(!/^.{8,80}$/.test(jQuery('#title').val())){
					error('title','标题长度必须为8-80个字');	
					return false;
				}else{
					success('title');
				}
				//验证活动的url链接地址
				if(!/^https?:\/\/([A-z0-9]+[_\-]?[A-z0-9]+\.)*[A-z0-9]+\-?[A-z0-9]+\.[A-z]{2,}(\/.*)*\/?$/.test(jQuery('#address').val())){
					error('address','活动链接地址格式错误');	
					return false;
				}else{
					success('address');
				}
				//验证活动结束时间
				if(jQuery('#enddate').val() == ''){
					error('enddate','请选填活动的结束时间');	
					return false;
				}else{
					success('enddate');
				}
				return true;
			}
			<!--{else}-->
			function check(){
				edit_save();
				//验证标题字数
				if(!/^.{8,80}$/.test(jQuery('#title').val())){
					error('title','标题长度必须为8-80个字');	
					return false;
				}else{
					success('title');
				}
				//验证活动地址
				if(!/^.{8,120}$/.test(jQuery('#address').val())){
					error('address','活动地址长度必须为8-120个字');
					return false;
				}else{
					success('address');
				}
				//验证活动城市
				if(jQuery('#city').val() == ''){
					error('city','请选择活动所在的城市');	
					return false;
				}else{
					success('city');
				}
				//验证活动结束时间
				if(jQuery('#enddate').val() == ''){
					error('enddate','请选填活动的结束时间');	
					return false;
				}else{
					success('enddate');
				}
				//验证推广人数
				if(!/^[1-9]{1}\d{0,2}$/.test(jQuery('#peoples').val())){
					error('peoples','推广入选人数必选,且必须是不超过3位的整数');
					return false;
				}else{
					success('peoples');
				}
				//验证联系人姓名
				if(!/^[\u4E00-\u9FA5]{2,5}$/.test(jQuery('#contactname').val())){
					error('contactname','联系人姓名只能是2-5个中文');	
					return false;
				}else{
					success('contactname');
				}
				//验证联系人电话
				if(!/^\d{3}-\d{8}$/.test(jQuery('#contacttel').val()) && !/^1\d{10}$/.test(jQuery('#contacttel').val())){
					error('contacttel','电话号码格式错误');
					return false;
				}else{
					success('contacttel');
				}
				//验证联系人QQ
				if(!/^\d{6,11}$/.test(jQuery('#contactqq').val())){
					error('contactqq','QQ号码格式错误');
					return false;
				}else{
					success('contactqq');
				}
				//检测是否验证活动奖品数量的设定
				if(jQuery('#lotteryArea').css('display') != 'none'){
					//检测活动奖品设定数量是否正确
					if(!/^[1-9]\d{1}$/.test(jQuery('#prizenum').val())){
						alert('中奖礼品数必须是小于100的正整数');
						return false;	
					}
				}
				return true;
			}
			jQuery(function(){
				//轮盘抽奖响应程序
				jQuery("input[name='lottery']").eq(1).click(function(){
					jQuery('#lotteryArea').hide();
				});
				jQuery("input[name='lottery']").eq(0).click(function(){
					jQuery('#lotteryArea').show();
				});
			});
			<!--{/if}-->
			function error(obj,msg){
				jQuery('#'+obj).parent(0).find('.msg').html('<font color="red">'+msg+'</font>');
			}
			function success(obj){
				jQuery('#'+obj).parent(0).find('.msg').html('');
			}
		</script>
<!--{template footer}-->